36. Learning Objectives - Bayes' Rule

Learning Objectives - Bayes' Rule

The following questions will help you review what you learned in the Bayes' Rule lesson.

Prior knowledge

For questions 1-3, assume you already have the following knowledge :

You’re interested in finding out the probability of a car stopping if it sees a yellow traffic light.

  • Past data tells you that the probability of a car stopping at a traffic light intersection is P(S) = 0.40 .

  • You also know that the past probability of a traffic light being yellow (as opposed to red or green) is P(Y) = 0.10 .

Car stopping at a yellow light

Car stopping at a yellow light

Traffic Light q1

When a car is stopped at an intersection, data shows that 12% of the time the light is yellow. So if we know a car is stopped, there's a 12% chance the light is yellow. This is called a conditional probability .

Given P(S) and P(Y) above, how would you represent this conditional probability in notation?

SOLUTION: P(Y|S) = 0.12

Traffic Light q2

Using what you know from question 1, answer the following: if the traffic light is yellow, what is the chance that the car will stop?

SOLUTION: 0.48

Traffic Light q3

Knowing that a car stopping at an intersection and the presence of a yellow traffic light are related events, what are P(S) and P(Y) known as?

SOLUTION: Prior probabilities

Questions 4 and 5 are different scenarios.

Prior knowledge for question 4:

On a four-lane highway, cars are either going fast or not fast. Faster cars should go in the leftmost lanes.

  • At any given time, 20% of cars are in the left-most lane.

  • Overall, 40% of cars on the highway are classified as going fast.

  • Out of all the cars in the leftmost lane, 90% are going fast.

Bayes q2

Given the above information, if a car is going fast, what is the probability that it will be in the leftmost lane?

SOLUTION: 0.45

Bayes' rule is not only used to incorporate sensor data into an estimate; it’s also often used to incorporate test data into a medical diagnosis.

Prior knowledge for question 5:

  • 1% of all people have cancer.
  • 90% of people who have cancer test positive when given a cancer-detecting blood test, meaning the test detects cancer 90% of the time.
  • 5% of people will have false positives, meaning that 5% of the time, this test will produce a positive result when people do not have cancer.

Bayes q3

Given the above data, what is the probability that a person has cancer if they have a positive cancer-test result? (Note: answers are rounded to the nearest 4th decimal place).

SOLUTION: 0.1538